<%@page import="com.user.entity.dto.TeacherDTO"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>学校在线考试系统</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/fileinput/fileinput.min.css" rel="stylesheet">
	<link href="css/bootstrap-table.css" rel="stylesheet">
	<link href="css/mystyle.css" rel="stylesheet">
	<link href="css/edit-paper-form.css" rel="stylesheet">
	<link href="css/test.css" rel="stylesheet">
	<link href="css/mgr-style.css" rel="stylesheet">
	<link href="css/bootstrap-select.min.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link href="css/font-awesome.min.css" rel="stylesheet">
<%!TeacherDTO teacher = new TeacherDTO(); %>
<%if(session.getAttribute("teacher")==null){
	response.sendRedirect("tch_login");
} else{
	teacher = (TeacherDTO)session.getAttribute("teacher");
}%>
</head>
<body id="body" onbeforeunload="return leavePage()">
	
		<div id="paper_container" class="col-lg-7 col-lg-offset-1 edit-paper-container">
			<div id="title_container" style="top:0;position:fixed;">
				<!-- 面包屑导航 -->
				<ol class="breadcrumb">
				    <li><a href="tch_index">首页</a></li>
				    <li><a href="tch_paper">试卷</a></li>
				    <li class="active">组卷</li>
				</ol>
				<div class="btn-toolbar edit-paper-toolbar" role="toolbar">
					<div style="margin-top:5px;" class="btn-group btn-group-sm">
						<button form="paper_form" type="submit" class="btn btn-primary" title="菜单"><span class="fa fa-save"></span>&nbsp;保存</button>
					</div>
					<div style="margin-top:5px;" class="btn-group btn-group-sm">
						<button type="button" class="btn btn-default" title="插入大题" onclick="addTopics()">添加大题</button>
					</div>
					<div style="margin-top:5px;" class="btn-group btn-group-sm">
					    <button id="btn_single" type="button" title="插入单选题" onclick="addSubTopics('Single')" class="btn btn-default">单选题</button>
					    <button id="btn_multiple" type="button" title="插入多选题" onclick="addSubTopics('Multiple')" class="btn btn-default">多选题</button>
					    <button id="btn_judgment" type="button" title="插入判断题" onclick="addSubTopics('Judgment')" class="btn btn-default">判断题</button>
					    <button id="btn_blank" type="button" title="插入填空题" onclick="addSubTopics('Blank')" class="btn btn-default">填空题</button>
					    <button id="btn_explanation" type="button" title="插入解答题" onclick="addSubTopics('Explanation')" class="btn btn-default">解答题</button>
					    <button id="btn_synthesized" type="button" title="插入综合题" onclick="addSubTopics('Synthesized')" class="btn btn-default">综合题</button>
					    <button id="btn_qubank" type="button" title="从题库中选择" onclick="openQuModel()" class="btn btn-default"><span class="fa fa-database">&nbsp;</span>题库</button>
					 </div>
					<div style="margin-top:5px;" class="btn-group btn-group-sm">
						<button id="btn_insert_option" type="button" class="btn btn-default" onclick="addSelection()" title="插入选项"><span class="fa fa-list-ol"></span>&nbsp;</button>
						<button id="btn_insert_blank" type="button" class="btn btn-default" onclick="insertBlank()" title="插入填空"><span class="fa fa-terminal"></span>&nbsp;</button>
					    <button id="btn_insert_photo" type="button" class="btn btn-default" onclick="openInsertImgWin()" title="插入图片"><span class="fa fa-image"></span>&nbsp;</button>
					   <!--  <button id="btn_insert_table" disabled type="button" class="btn btn-default" onclick="test()" title="插入表格"><span class="fa fa-th"></span>&nbsp;</button> -->
					</div>
					<div style="margin-top:5px;" class="btn-group btn-group-sm">
						<button id="btn_up" type="button" class="btn btn-default" onclick="topicsUp()" title="上移"><span class="fa fa-long-arrow-up"></span>&nbsp;</button>
						<button id="btn_down" type="button" class="btn btn-default" onclick="topicsDown()" title="下移"><span class="fa fa-long-arrow-down"></span>&nbsp;</button>
						<button id="btn_remove_option" type="button" class="btn btn-default" onclick="removeOptions()" title="删除选项"><span class="fa fa-close"></span>&nbsp;</button>
					    <button id="btn_remove_topic" type="button" class="btn btn-default" onclick="removeTopics()" title="删除题目"><span class="fa fa-trash"></span>&nbsp;</button>
					</div>
				</div>
			</div>
			
			<!-- 自定义的编辑试卷组件 -->
			<form id="paper_form" class="form-horizontal" role="form" method="post">
			<div class="edit-paper-title">
					<div  style="width:780px;">
						<input type="hidden" id="load_id">
						<input type="hidden" id="paper_id">
						<div class="question-options-index"style="float:left;" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;标题：</div><div id="paper_title" class="paper-msg-content" style="overflow:hidden;" contenteditable="true"></div>
						<div class="question-options-index" style="float:left;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编号：</div><div id="paper_num" class="paper-msg-content" style="overflow:hidden;" contenteditable="true"></div>
						<div class="question-options-index" style="float:left;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;描述：</div><div id="paper_desc" class="paper-msg-content" style="overflow:hidden;" contenteditable="true"></div>
						<div class="question-options-index" style="float:left;">考试时长：</div><div id="paper_time" class="paper-msg-content" style="overflow:hidden;" contenteditable="true"></div>
						<div class="question-options-index" style="float:left;">试卷类型：</div>
						<div id="paper_type" style="overflow:hidden;">
							<label><input required type="radio" name="paper_type" value="Exercise">练习卷</label>
							<label><input type="radio" name="paper_type" value="Formal">正式卷</label>
						</div>
						<div class="question-options-index" style="float:left;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;科目：</div><input type="hidden"  id="paper_subject" value='<%=request.getParameter("subject_id") %>'><div style="overflow:hidden;">&nbsp;<%=request.getParameter("subject_name") %></div>
						<div id="paper_teacher" class="question-options-index" style="float:left;">组卷教师：</div><div style="overflow:hidden;">&nbsp;</div>
						<div id="paper_score" class="question-options-index">试卷总分：</div><div style="overflow:hidden;"><span>0</span></div>
					</div>
				
			</div>
			
			
			<div><font class="paper-total-score" color="blue">试卷总分：<span></span></font></div>
			<div class="edit-paper-body" style="width:780px">
			
				<!-- <div class="paper-topics-item">
					<input type="hidden" class="topics-id">
					<input type="hidden" class="topics-index-value" value=1>
					<div class="paper-topics-index"><span>一</span>、</div>
					<div class="paper-topics-title" contenteditable="true"></div>
					<font class="paper-topics-score" color="blue"><i>(总分：<span></span>)</i></font>
					<div class="paper-subtopics-item">
						<input type="hidden" class="subtopics-id">
						<input type="hidden" class="question-type" value="Single">
						<input type="hidden" class="subtopics-index-value" value=1>
						<div class="paper-subtopics-index"><span>1</span>、</div>
						<div class="paper-subtopics-title" contenteditable="true"></div>
						<font color="blue"><i>(单选题)</i></font>
						<div class="paper-subtopics-body">
							<div class="subtopics-options-item">
								<div class="question-options-index"><input required type="radio" name="1-1"><span>A</span>.</div>
								<div class="question-options-content" contenteditable="true" ></div>
							</div>
						</div>
						<div class="question-answer">参考答案：<font color="blue">A</font></div>
						<div class="paper-subtopics-score">
							<span>分值：</span><input onchange="_inputScore(this)" class="subtopics-score-input" onkeyup="value=value.replace(/[^\d.]/g,'')" required type="text">
						</div>
					</div>
				</div> -->
			</div>
			
			</form>
		</div>
			<!-- 模态框（Modal） -->
			<div class="modal fade" id="insertImgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			    <div class="modal-dialog" style="width:830px">
			        <div class="modal-content">
			            <div class="modal-header">
			                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			                <h4 class="modal-title" id="myModalLabel">插入图片</h4>
			            </div>
			            <div class="modal-body">
			            	<p><img width="400" id="imgPrev" src=""></p>
			            	调整大小<input id="imgSize" type="range" onchange="changeImgSize()">
			            	<form id="imgUploadForm" method="post" action="files/upload" enctype="multipart/form-data">
			            		<input onchange="imgValueChange()" type="file" id="imgUpload" name="myFileName">
			            	</form>
			            </div>
			            <div class="modal-footer">
			            	<button type="button" onclick="insertImg()" class="btn btn-primary">确定</button>
			                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			            </div>
			        </div><!-- /.modal-content -->
			    </div><!-- /.modal -->
			</div>
			
			
			<!-- 模态框（Modal） -->
			<div class="modal fade" id="quListModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			    <div class="modal-dialog" style="width:60%;">
			        <div class="modal-content">
			            <div class="modal-header">
			                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			                <h4 class="modal-title" id="myModalLabel">插入图片</h4>
			            </div>
			            <div class="modal-body">
			            	<ul id="myTab" class="nav nav-tabs">
								<li class="active">
									<a href="#Single" data-toggle="tab">
										单选题
									</a>
								</li>
								<li><a href="#Multiple" data-toggle="tab">多选题</a></li>
								<li><a href="#Judgment" data-toggle="tab">判断题</a></li>
								<li><a href="#Blank" data-toggle="tab">填空题</a></li>
								<li><a href="#Explanation" data-toggle="tab">解答题</a></li>
								<li><a href="#Synthesized" data-toggle="tab">综合题</a></li>
							</ul>
							<div id="myTabContent" class="tab-content">
								<div class="tab-pane fade in active" id="Single">
									<table id="singleTable"></table>
								</div>
								<div class="tab-pane fade" id="Multiple">
									<table id="multipleTable"></table>
								</div>
								<div class="tab-pane fade" id="Judgment">
									<table id="judgmentTable"></table>
								</div>
								<div class="tab-pane fade" id="Blank">
									<table id="blankTable"></table>
								</div>
								<div class="tab-pane fade" id="Explanation">
									<table id="explanationTable"></table>
								</div>
								<div class="tab-pane fade" id="Synthesized">
									<table id="synthesizedTable"></table>
								</div>
							</div>
			            </div>
			            <div class="modal-footer">
			                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			            </div>
			        </div><!-- /.modal-content -->
			    </div><!-- /.modal -->
			</div>
		
	
		
	
	
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-1.12.4.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/fileinput/fileinput.min.js"></script>
    <script src="js/fileinput/fileinput-zh.js"></script>
    <script src="js/public.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    
    <script src="js/jquery-form.js"></script>
	<script src="js/bootstrap-table.js"></script>
	<script src="js/bootstrap-table-zh-CN.js"></script>
	<script src="js/bootstrap-select.min.js"></script>
	<script src="js/inputGroup-1.1.js"></script>
	<script src="js/jquery.validate.min.js"></script>
	<script src="js/messages_zh.js"></script>
	
	<script src="js/tch/PaperFormController2.js"></script>
	<script src="js/tch/tch_getTask.js"></script>
  </body>
</html>